<template>
	<el-dialog :title="dialogTitle" v-model="visible" :close-on-click-modal="false" draggable>
		<form-create v-model="formData" :rule="formFields" :option="formConfig" @submit="onSubmit"></form-create>
	</el-dialog>
</template>

<script setup lang="ts">
import { IFlwProcessVO } from '@/api/oa/flwProcess';

const visible = ref(false);

const dialogTitle = ref('');
const formFields = ref([]);
const formConfig = ref({});
const formData = ref({});

// const loading = ref(false);
// 打开弹窗
const open = (item: IFlwProcessVO) => {
	dialogTitle.value = `发起${item.processName}`;
	formFields.value = JSON.parse(item.formFields);
	formConfig.value = JSON.parse(item.formConf);
	visible.value = true;
};

function onSubmit() {
	// eslint-disable-next-line no-console
	console.log(formData.value);
}

// 暴露变量
defineExpose({
	open,
});
</script>
